package com.kongmou.springReview.commonCfg.scope;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class TestScope {
	public static void main(String[] args) {
		ApplicationContext context = new AnnotationConfigApplicationContext(ScopeConfig.class);
		DemoSingletonService s1 = context.getBean(DemoSingletonService.class);
		DemoSingletonService s2 = context.getBean(DemoSingletonService.class);

		DemoPrototypeService p1 = context.getBean(DemoPrototypeService.class);
		DemoPrototypeService p2 = context.getBean(DemoPrototypeService.class);

		System.out.println("单例是否是同一个s1和s2：" + s1.equals(s2));
		System.out.println("原型是否是同一个p1和p2：" + p1.equals(p2));
	}

}
